// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: jhkim

#pragma once
#include "coin2/strategy/util/quote_sizer.h"


namespace coin2::strategy::linear_model {

using coin2::strategy::util::GetQtyFromQuote;

inline double GetQuoteFromPq(
    const coin2::exchange::base::symbology::IProductHolder& pholder,
    double price,
    double qty) {
  const auto& pi = pholder.product_info();
  double contract_value = 1.0;
  if (pi.contract_value() > 0) {
    contract_value = pi.contract_value();
  }
  if (pi.is_inverse()) {
    return qty * contract_value;
  } else {
    return price * qty * contract_value;
  }
}

}  // namespace coin2::strategy::linear_model::util
